<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class Css extends Public_Controller {

	function __construct()
	{
		parent::__construct();
		$this->sSkinFile = 'ajax';
	}
	
	
	function index($sCalls = '')
	{
	
		$this->output->set_header('Content-Type: text/css');
		$this->output->set_header("Expires: " . gmdate("D, d M Y H:i:s", (time() + 315360000)) . " GMT");
		$this->output->set_header("Cache-Control: max-age=315360000");
		$this->output->set_header("Set-Cookie: ");

		$sOutput = '';
		
		if ($sCalls !== '')
		{

			if (stristr($sCalls, $this->config->item('media_func_sep')) !== false)
			{
				$this->aFuncCalls = explode($this->config->item('media_func_sep'), $sCalls);
			}
			else 
			{
				$this->aFuncCalls[] = $sCalls;
			}
			
			foreach ($this->aFuncCalls as $sFuncCall)
			{
				if (substr($sFuncCall, 0 - strlen($this->config->item('css_ext'))) === $this->config->item('css_ext'))
				{
					$sFuncCall = substr($sFuncCall, 0, 0 - strlen($this->config->item('css_ext')));
				}
								
				if (method_exists($this, $sFuncCall) === true)
				{
					$sOutput .= $this->$sFuncCall().chr(10);
				}
			}
			
			
			if ($this->config->item('minify_css') === true)
			{
				
				$this->load->library('cssmin');
				
				$sOutput = $this->cssmin->minify($sOutput);
			}
		}
		
		$this->load->view('gen_output', array('output' => $sOutput));
	}

	
	
	/*FRONTEND*/
	
	public function generic()
	{
		return $this->load->view('media/css/generic', array(), true);
	}
	
	public function ie_css()
	{
		return $this->load->view('media/css/ie_css', array(), true);
	}
	
	public function ie_six_css()
	{
		return $this->load->view('media/css/ie_six_css', array(), true);
	}
	
	
	
	/*ADMIN*/
	
	public function admin_main()
	{
		return $this->load->view('media/css/admin/main', array(), true);
	}
	
	public function admin_login()
	{
		return $this->load->view('media/css/admin/login', array(), true);
	}


	public function admin_top_nav()
	{
		return $this->load->view('media/css/admin/top_nav', array(), true);
	}


	public function admin_top_menu()
	{
		return $this->load->view('media/css/admin/top_menu', array(), true);
	}


	public function admin_footer()
	{
		return $this->load->view('media/css/admin/footer', array(), true);
	}

	public function admin_home()
	{
		return $this->load->view('media/css/admin/home', array(), true);
	}
	
	public function admin_pages()
	{
		return $this->load->view('media/css/admin/pages', array(), true);
	}
	
	public function admin_edit_page()
	{
		return $this->load->view('media/css/admin/edit_page', array(), true);
	}
	
	public function admin_banners()
	{
		return $this->load->view('media/css/admin/banners', array(), true);
	}
	
	public function admin_edit_banner()
	{
		return $this->load->view('media/css/admin/edit_banner', $this->aData, true);
	}
	
	public function admin_spotlights()
	{
		return $this->load->view('media/css/admin/spotlights', array(), true);
	}
	
	public function admin_edit_spotlight()
	{
		return $this->load->view('media/css/admin/edit_spotlight', $this->aData, true);
	}
	
	public function admin_media()
	{
		return $this->load->view('media/css/admin/media', array(), true);
	}
	
	public function admin_edit_media()
	{
		$sRet = '';
		
		foreach ($this->config->item('admin_image_editing_tools') as $sCssInclude => $aVars) 
		{
			if ($aVars['hasCss'] === true)
			{
				$sRet .= $this->load->view('media/css/admin/edit_media/'.$sCssInclude, $this->aData, true);
			}
		}
		
		
		$sRet .= $this->load->view('media/css/admin/edit_media', $this->aData, true);
		

		
		return $sRet;
	}
	
	public function admin_menu_order()
	{
		return $this->load->view('media/css/admin/menu_order', array(), true);
	}
	
	public function admin_sites()
	{
		return $this->load->view('media/css/admin/sites', array(), true);
	}
	
	public function admin_edit_site()
	{
		return $this->load->view('media/css/admin/edit_site', array(), true);
	}
	
	public function admin_languages()
	{
		return $this->load->view('media/css/admin/languages', array(), true);
	}
	
	public function admin_edit_language()
	{
		return $this->load->view('media/css/admin/edit_language', array(), true);
	}
	
	public function admin_gmaps()
	{
		return $this->load->view('media/css/admin/gmaps', array(), true);
	}
	
	public function admin_edit_gmap()
	{
		return $this->load->view('media/css/admin/edit_gmap', $this->aData, true);
	}
	
	public function admin_short_urls()
	{
		return $this->load->view('media/css/admin/short_urls', $this->aData, true);
	}
	
	public function admin_edit_short_url()
	{
		return $this->load->view('media/css/admin/edit_short_url', $this->aData, true);
	}
	
	public function admin_access_rights()
	{
		return $this->load->view('media/css/admin/access_rights', $this->aData, true);
	}
	
	public function admin_components()
	{
		return $this->load->view('media/css/admin/components', $this->aData, true);
	}
	
	public function admin_projects()
	{
		return $this->load->view('media/css/admin/projects', $this->aData, true);
	}
	


	/*JQUERY*/
	
	public function jquery_ui()
	{
		return $this->load->view('media/css/jquery_ui/smoothness', array(), true);
	}
	
	
	public function jquery_treeview()
	{
		return $this->load->view('media/css/admin/jquery_treeview', array(), true);
	}


	public function jquery_uploadify()
	{
		return $this->load->view('media/css/admin/jquery_uploadify', array(), true);	
	}


	public function jquery_jcrop()
	{
		return $this->load->view('media/css/admin/jquery.jcrop.php', $this->aData, true);	
	}


	public function jquery_impromptu()
	{
		return $this->load->view('media/css/admin/jquery.impromptu.php', array(), true);	
	}


	public function jquery_lightbox()
	{
		return $this->load->view('media/css/jquery_ui/jquery.lightbox.php', array(), true);	
	}
	

	public function intranet_home()
	{
		$this->load->model('db/intranet_icons', 'intranet_icons');
		
		$qIntranetIcons = $this->intranet_icons->get();
		
		$this->aData['qIntranetIcons'] = $qIntranetIcons;
		
		return $this->load->view('media/css/intranet/home', $this->aData, true);		
	}
	
	
	
	/*CODEMIRROE*/
	
	public function codemirror()
	{
		$sRet = $this->load->view('media/css/admin/codemirror/codemirror', $this->aData, true);
		$sRet .= $this->load->view('media/css/admin/codemirror/mode/xml/xml', $this->aData, true);
		$sRet .= $this->load->view('media/css/admin/codemirror/mode/css/css', $this->aData, true);
		$sRet .= $this->load->view('media/css/admin/codemirror/mode/javascript/javascript', $this->aData, true);
		
		return  $sRet;
	}
	
	
}

?>
